package com.example.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EmployeeScoreMapper {
    @Insert("insert into tb_employee_score(employeeId, score, createAt, userCommentId) values(#{employeeId}, #{score}, CURRENT_TIMESTAMP, #{userCommentId})")
    int addEmployeeScore(@Param("employeeId") Integer employeeId, @Param("score") Integer socre,
            @Param("userCommentId") Integer userCommentId);

    @Select("SELECT AVG(score) FROM tb_employee_score WHERE employeeId = #{employeeId}")
    Double getAverageScoreByEmployeeId(int employeeId);

    @Select("select userCommentId from tb_employee_score where employeeId = #{employeeId}")
    List<Integer> getCommentIdsByEmployeeId(@Param("employeeId") Integer employeeId);
}
